﻿using System;
using System.Collections.Generic;

#if UNITY_EDITOR
using System.IO;
using UnityEditor;
#endif

using UnityEngine;

namespace HKTools
{
    [Serializable]
    public class HK_UIPanelItem
    {
        public HK_PanelType PanelType;
        public PanelName PanelName;
        public HK_PanelBase Panel;
        public int Order;  // Panel排序的优先级
    }

    public class HK_UIConfig : ScriptableObject
    {
        [SerializeField]
        public List<HK_UIPanelItem> UIPanels;
    }

#if UNITY_EDITOR
    public class HK_CreateUIConfig
    {
        const int CreateUIConfigPriority = 101;

        [MenuItem("HKTools/HK_UGUI/CreateUIConfig", priority = CreateUIConfigPriority)]
        public static void CreateUIConfigDatabase()
        {
            HK_UIConfig config = ScriptableObject.CreateInstance<HK_UIConfig>();

            string path;

            if (Directory.Exists("Assets/HKTools/ForRuntime/12.HK_UGUITools/0.HK_UIFramework/Resources"))
            {
                path = "Assets/HKTools/ForRuntime/12.HK_UGUITools/0.HK_UIFramework/Resources/HK_UIConfig.asset";
            }
            else
            {
                path = "Assets/Resources/HK_UIConfig.asset";
            }

            AssetDatabase.CreateAsset(config, path);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
    }
#endif
}